﻿<%@ Page Language="C#" MasterPageFile="~/JOINT/MstPage_JOINT.master" AutoEventWireup="true"
    CodeFile="frmJ_TraineeAppAssignConfirm.aspx.cs" Inherits="JOINT_frmJ_TraineeAppAssignConfirm"
    Title="面接情報確認・承認" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    面接情報確認・承認</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <link href="../Style/JsStyle.css" rel="stylesheet" type="text/css" />
    <link href="../Style/Style.css" rel="stylesheet" type="text/css" />
    <link href="../Style/datepicker.css" rel="stylesheet" type="text/css" />
    <style>
        .font
        {
            font-family: MS UI Gothic;
        }
        .hiden
        {
            display: none;
        }
        .ddlJ_TraineeSearch
        {
            font-size: 10pt;
        }
        #showCalendar
        {
        	padding-top: 35px;
            position: absolute;
            z-index: 1000;
        }
        #background
        {
            display: none;
            position: absolute;
            height: 100%;
            width: 100%;
            top: 0;
            left: 0;
            background: #000000;
            z-index: 1;
        }
    </style>

    <script src="../js/jquery.min.js" type="text/javascript"></script>
    
    <script src="../js/datepicker.js" type="text/javascript"></script>
    
    <script src="../js/jquery.blockUI.js" type="text/javascript"></script>

    <script src="../js/Validation.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
        var countcb;
        $(document).ready(function() {
            registerStartup();
            
        });

        function registerStartup() {
            countcb = parseInt($('#<%= hdCount.ClientID %>').val());
            disableControlOnLoadUpdatePanel("<%= UpdatePanel1.ClientID %>", "<%= ddl_組合選択.ClientID %>");
            
            registerControlToValidation("validation");

            formatDate("css_text_calender", "/");

            registerEnterEvent("next_control", "<%= btn決定.ClientID %>", 3);

            if (countcb <= 0) {
                document.getElementById("<%=btnPDF一括出力.ClientID%>").disabled = true;
                document.getElementById("<%=Button1.ClientID %>").disabled = true;
            } else {
            document.getElementById("<%=btnPDF一括出力.ClientID%>").disabled = false;
                document.getElementById("<%=Button1.ClientID %>").disabled = false;
            }
            $("#ctl00_ContentPlaceHolder1_ddl_textbox2").bind("keydown", function(e) {
                var key = e.which;
                if (key == 13 && !e.shiftKey) {
                    $("#ctl00_ContentPlaceHolder1_ddl_組合選択").focus();
                }
            });
            
//            $.ajax({
//                type: "POST",
//                contentType: "application/json;charset=utf-8",
//                url: "frmJ_TraineeAppAssignConfirm.aspx/Calendar",
//                data: "{組合選択:'" + $('#ctl00_ContentPlaceHolder1_ddl_組合選択').val() + "',組合員企業選択:'" + $('#ctl00_ContentPlaceHolder1_ddl_組合員企業選択').val() + "'}",
//                dataType: "json",
//                beforeSend: function(e)
//                {
//                    $('#showCalendar').html('');
//                },
//                success: function(data) {
            //                    var cal = data.d;
//            if ($("#<%= HiddenField2.ClientID %>").val() != "") {
                var A = $("#<%= HiddenField2.ClientID %>").val().split(',');
                $('#showCalendar').html('');
                $('#showCalendar').DatePicker({
                    calendar_content:'calendar_content',
                    control: 'ctl00_ContentPlaceHolder1_ddl_textbox2',
                    flat: true,
                    date: A,
                    current: Date.Now,
                    format: 'Y-m-d',
                    calendars: 1,
                    mode: 'multiple',
                    starts: 1
                });
                $('#showCalendar').hide();
                //                }
                //            });
                $('#buttonCal').click(function() {
                    $("#background").css({ "opacity": "0" }).fadeIn("fast");
                    $("#showCalendar").show();
                });
                $('#background').click(function() {
                    $('#background').fadeOut('fast');
                    $('#showCalendar').hide();
                });
    //        }
           
       }

        function CheckIsCheckBox() {
            var count_checkbox_true = 0;
            var count_length_checkbox = -1;
            $('#<%=grv.ClientID %>').find("input:checkbox").each(function() {
                if (this.checked == true) {
                    count_checkbox_true++;
                }
                count_length_checkbox++
            });
            if (count_length_checkbox == count_checkbox_true)
                document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = true;
        }

        //SELLECT ALL CHECKBOX
        function SelectAllCheckboxes(spanChk) {
            countcb = parseInt($('#<%= hdCount.ClientID %>').val());
            // Added as ASPX uses SPAN for checkbox
            var oItem = spanChk.children;

            var theBox = (spanChk.type == "checkbox") ? spanChk : spanChk.children.item[0];
            xState = theBox.checked;
            document.getElementById("<%=btnPDF一括出力.ClientID%>").disabled = !xState;
            document.getElementById("<%=Button1.ClientID %>").disabled = !xState;
            $(".chk").each(function() {
                var chk = document.getElementById($(this).children('input').attr('id'));
                var checked = chk.checked;
                if (xState) {
                    if (!checked) {
                        chk.checked = true;
                        countcb++;
                    }
                }
                else {
                    if (checked) {
                        chk.checked = false;
                        countcb--;
                    }
                }               
            })
            if (countcb <= 0) {
                document.getElementById("<%=btnPDF一括出力.ClientID%>").disabled = true;
                document.getElementById("<%=Button1.ClientID %>").disabled = true;
            } else {
                document.getElementById("<%=btnPDF一括出力.ClientID%>").disabled = false;
                document.getElementById("<%=Button1.ClientID %>").disabled = false;
            }
            $('#<%= hdCount.ClientID %>').val(countcb);
        }
        function CountCheck(element) {
            countcb = parseInt($('#<%= hdCount.ClientID %>').val());
            var chk = element.firstChild;
            if (chk.checked) {
                countcb++;
            }
            else {
                countcb--;
            }
            $('#<%= hdCount.ClientID %>').val(countcb);
            if (countcb <= 0) {
                document.getElementById("<%=btnPDF一括出力.ClientID%>").disabled = true;
                document.getElementById("<%=Button1.ClientID %>").disabled = true;
            } else {
                document.getElementById("<%=btnPDF一括出力.ClientID%>").disabled = false;
                document.getElementById("<%=Button1.ClientID %>").disabled = false;
            }
            var objCheck = new Object;
            objCheck.LengthCount = 0;
            objCheck.CheckedCount = 0;
            $(".chk").each(function() {
                objCheck.LengthCount++;
                var chk = document.getElementById($(this).children('input').attr('id'));
                var checked = chk.checked;
                if (checked) {
                    objCheck.CheckedCount++;
                }
            })
            var theBox = document.getElementById("ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択");
            if (objCheck.CheckedCount == objCheck.LengthCount) {
                theBox.checked = true;
            } else {
                theBox.checked = false;
            }
        }

            

    </script>

    <div class="maindiv1">
        <asp:HiddenField ID="hdCheck" runat="server" />
        <asp:HiddenField ID="hdCountGrv" runat="server" />
        <div class="div_content">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:HiddenField ID="hdCount" runat="server" />
                    <br />
                    <div class="detail-admin-row">
                    <div class="detail-admin-row1">
                        <span class="detail-admin-label">組合選択 : </span>
                        <asp:DropDownList ID="ddl_組合選択" runat="server" CssClass="next_control validation dropdownlist width2"
                            AutoPostBack="True" OnSelectedIndexChanged="ddl_組合選択_SelectedIndexChanged">
                            <asp:ListItem Value="-1" Selected="true">[選択]</asp:ListItem>
                        </asp:DropDownList>
                        <span class="required-field">*</span>
                        <asp:RequiredFieldValidator runat="server" ID="RFV_ddl_組合選択" ControlToValidate="ddl_組合選択"
                            Display="None" InitialValue="-1" ErrorMessage=""></asp:RequiredFieldValidator>
                        <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="VCE_ddl_組合選択" TargetControlID="RFV_ddl_組合選択"
                            HighlightCssClass="invalid" CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png"
                            Width="240px">
                        </ajaxToolkit:ValidatorCalloutExtender>
                    </div>
                    <div class="detail-admin-row2">
                        <span class="detail-admin-label">組合員企業選択 :</span>
                        <asp:DropDownList ID="ddl_組合員企業選択" runat="server" CssClass="next_control validation  dropdownlist width2"
                            onselectedindexchanged="ddl_組合員企業選択_SelectedIndexChanged" 
                            AutoPostBack="True" >
                            <asp:ListItem Value="-1" Selected="true">[選択]</asp:ListItem>
                        </asp:DropDownList>
                        <span class="required-field">*</span>
                        <asp:RequiredFieldValidator runat="server" ID="RFV_組合員企業選択" ControlToValidate="ddl_組合員企業選択"
                            Display="None" InitialValue="-1" ErrorMessage=""></asp:RequiredFieldValidator>
                        <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="VCE_組合員企業選択" TargetControlID="RFV_組合員企業選択"
                            HighlightCssClass="invalid" CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png"
                            Width="240px">
                        </ajaxToolkit:ValidatorCalloutExtender>
                    </div>
                    </div>
                    <asp:HiddenField ID="HiddenField2" runat="server" />
                    <div class="detail-admin-row">
                        <div class="detail-admin-row1">
                            <asp:HiddenField ID="hd_field" runat="server" />
                            <br />
                            <span class="detail-admin-label125 detail-admin-label125_fixedforfrmJ_TraineeAppAssignCheck">
                                面接日 :</span>
                            <asp:DropDownList ID="ddl_textbox2" runat="server" CssClass="next_control validation  dropdownlist width2"
                                onselectedindexchanged="ddl_textbox2_SelectedIndexChanged" AutoPostBack="true">
                                <asp:ListItem Value="-1" Selected="true">[選択]</asp:ListItem>
                            </asp:DropDownList> 
                            <input type="button" id="buttonCal" value="" class="calendar"/>   
                            <span class="required-field">*</span>
                            <asp:RequiredFieldValidator runat="server" ID="RFV_面接日" ControlToValidate="ddl_textbox2"
                                Display="None" ErrorMessage="" InitialValue="-1"></asp:RequiredFieldValidator>
                            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="VCE_面接日1" TargetControlID="RFV_面接日"
                                HighlightCssClass="invalid" CssClass="CustomValidatorCalloutStyle" WarningIconImageUrl="../Images/warning.png"
                                Width="240px">
                            </ajaxToolkit:ValidatorCalloutExtender>
                        </div>
                            <div id="showCalendar" class="calendar_content">
                            </div>
                    </div>
                    <div class="detail-admin-row">
                        
                        <div class="btn_back">
                            &nbsp;
                        </div>
                        <div class="btn_next" style="margin-left: 150px;display:none">
                            <asp:Button ID="btn決定" runat="server" Text="決定" CssClass="btn" OnClick="btn決定_Click"
                                OnClientClick="javascript:focusToControlErr();" />
                        </div>
                    </div>
                    <div class="div_height20">
                    </div>
                    <div class="Header4">
                    </div>
                    <div class="div_grv" style="width: 740px">
                        <div class="required-field">
                            ※名前をクリックしたら、対象者の情報をPDF出力します。</div>
                        <div class="detail-admin-row">
                            <br />
                        </div>
                        <br />
                        <asp:GridView ID="grv" runat="server" Width="100%" ShowFooter="false" AutoGenerateColumns="False"
                            CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt"
                            OnPageIndexChanging="grv_PageIndexChanging" PageSize="10" AllowPaging="true"
                            OnRowDataBound="grv_RowDataBound" OnPreRender="grv_PreRender">
                            <Columns>
                                <asp:BoundField HeaderText="ID2" DataField="id2" Visible="false" />
                                <asp:TemplateField HeaderText="氏名">
                                    <ItemTemplate>
                                        <div style="width: 156px">
                                            <asp:LinkButton ID="LinkButton1" runat="server" CommandName="link" OnCommand="lk1_Click"
                                                CommandArgument="<%#((GridViewRow) Container).RowIndex %>"> <%#Eval("氏名")%></asp:LinkButton>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="氏名" DataField="氏名" HeaderStyle-CssClass="hiden" ItemStyle-CssClass="hiden">
                                    <HeaderStyle CssClass="hiden" />
                                    <ItemStyle CssClass="hiden" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="ＩＤ番号" DataField="ID" ItemStyle-Width="90px">
                                    <ItemStyle Width="90px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="生年月日" DataField="生年月日" DataFormatString="{0:yyyy年MM月dd日}"
                                    ItemStyle-Width="100px">
                                    <ItemStyle Width="100px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="組合名" DataField="組合名" ItemStyle-Width="100px">
                                    <ItemStyle Width="100px" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="企業名" DataField="企業名" ItemStyle-Width="165px">
                                    <ItemStyle Width="165px" />
                                </asp:BoundField>
                                <asp:TemplateField>
                                    <HeaderTemplate>
                                        承認
                                        <asp:CheckBox ID="ckb_全て選択" runat="server" onclick="javascript:SelectAllCheckboxes(this);">
                                        </asp:CheckBox>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <center>
                                            <asp:CheckBox ID="CheckBox1" runat="server" CssClass="chk" onchange="CountCheck(this);" /></center>
                                        <asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("id2") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <PagerSettings FirstPageText="最初" Mode="NumericFirstLast" PageButtonCount="5" LastPageText="最後" />
                            <PagerStyle CssClass="pgr"></PagerStyle>
                            <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
                        </asp:GridView>
                        <div class="div_height20">
                        </div>
                    </div>
                    <div id="background"></div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <div class="btn_next btn_next_fixeforfrmJ_TraineeLangAbilityInput" style="margin-left: 150px">
            <asp:Button ID="btnPDF一括出力" runat="server" Text="PDF一括出力" CssClass="btn" OnClick="btnPDF一括出力_Click" />
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            <asp:Button ID="Button1" runat="server" Text="一括承認" CssClass="btn" OnClick="btn一括承認_Click" />
        </div>
    </div>
    <div class="div_height20">
    </div>
    <div>
        &nbsp;</div>
    <br />
</asp:Content>
